package com.sandy.gorm7

import grails.gorm.transactions.Transactional
import groovy.transform.CompileStatic
import org.springframework.stereotype.Component

@Component
@CompileStatic
class BootStrap {
    @Transactional
    void init() {
        println 'init'
//        Manufacturer audi = new Manufacturer(name: 'audi')
//        audi.addToVehicles(new Vehicle(name: 'A3', year: 1996))
//        audi.addToVehicles(new Vehicle(name: 'A4', year: 1994))
//        audi.save()
//
//        Manufacturer ford = new Manufacturer(name: 'ford')
//        ford.addToVehicles(new Vehicle(name: 'Ford KA', year: 1996))
//        ford.save()
        def address = new Address(
                number: 'dalian',
                postCode: '116000'
        ).save()
        def person = new Person(
                firstName: 'sandy',
                address: address
        ).save()
    }
}
